﻿(function () {
    "use strict";

    WinJS.UI.Pages.define("/pages/home/home.html", {
        // This function is called whenever a user navigates to this page. It
        // populates the page elements with the app's data.
        ready: function (element, options) {
            // TODO: Initialize the page here.
            var PlayButton = document.getElementById("playbutton");
            PlayButton.addEventListener("click", Play, false);
        }
    });

    function Play() {
        var username = document.getElementById("username").value;
        if (username.length == 0) {
            document.getElementById("message").innerText = "Please input your name!"
        }
        else {
            WinJS.Application.UserName = username;
            WinJS.Navigation.navigate("/pages/game/game.html");
        }
    }
})();
